package com.woniu.houtai.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniu.houtai.entity.Type;
import com.woniu.houtai.mapper.TypeMapper;
import com.woniu.houtai.service.TypeService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author firstGroup
 * @since 2023-02-22 09:45:58
 */
@Service
public class TypeServiceImpl extends ServiceImpl<TypeMapper, Type> implements TypeService {

    @Autowired
    TypeMapper typeMapper;
    public Integer insert(Type type) {
        return typeMapper.insert(type);
    }

    @Override
    public List<String> selectTypeNameByShopId(Integer shopId) {
        QueryWrapper<Type> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("shop_id",shopId);
        return typeMapper.selectTypeNameByShopId(shopId);
    }

    @Override
    public Integer deleteByShopId(Integer shopId) {
        QueryWrapper<Type> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("shop_id",shopId);
        return typeMapper.delete(queryWrapper);
    }


}
